<?php
/**
 *
 * - <b>DEBUG</b> or <b>UF_DEBUG</b>: If you want to enable Debuging you have to defined one of the constants.
 * - <b>UF_NOTICES_SHOW</b>: If you want enable, showing all Notices while debuging, you have to define this constant.
 * - <b>UF_NO_EXCEPTION_HANDLER</b> If you define this constant, the framework internal exception handler will not
 *   be used. (Its anabled by default)
 * - <b></b>
 *
 *
 */

namespace
{

    # <editor-fold defaultstate="collapsed" desc="Function unixizePath">
    /**
     * @ignore
     * @internal
     */
    function unixizePath( $path, $endsWithSeparator=null )
    {
       if (\is_null($endsWithSeparator) )
           return \str_replace( '\\', '/', $path );
       return \rtrim( \str_replace( '\\', '/', $path ), '/' ) .
           ( $endsWithSeparator ? '/' : '');
    }
    # </editor-fold>

    # <editor-fold defaultstate="collapsed" desc="- - - -   G L O B A L   C O N S T A N T S   - - - - - - - - - - - - - - - - - - - - -">

    \define ( 'UF_BASE_FOLDER', \unixizePath( \realpath( __DIR__ ), false ) );

    /**
     * Läuft das Framwork aktuell auf einem Windows-System?
     *
     * @since  v0.1
     */
    \define ( 'IS_WIN', 'WIN' === \strtoupper( \substr( \PHP_OS, 0, 3 ) ) );

    /**
     * Read access to a file.
     *
     * @since  v0.1
     */
    \define( 'FILE_ACCESS_READ', 'read' );

    /**
     * Write access to a file.
     *
     * @since  v0.1
     */
    \define( 'FILE_ACCESS_WRITE', 'write' );

    /**
     * Read and write access to a file.
     *
     * @since  v0.1
     */
    \define( 'FILE_ACCESS_READWRITE', 'read and write' );

    /**
     * This constant defines if the Multibyte PHP extension is enabled/usable.
     *
     * @since  v0.1
     */
    \define( 'MB_ENABLED', function_exists( '\\mb_strlen' ) );

    /**
     * This constant defines if the INTL PHP extension is enabled/usable.
     *
     * @since  v0.1
     */
    \define( 'MOD_INTL', \extension_loaded( 'intl' ) );

    /**
     * Is the PECL Imagick Extension loaded?
     */
    define ( 'MOD_IMAGICK', \class_exists('\\Imagick') );

    # <editor-fold defaultstate="collapsed" desc="G R A V I T Y   C O N S T A N T S">

    if ( \MOD_IMAGICK )
    {
        define ( 'GRAVITY_TOP',         \Imagick::GRAVITY_NORTH );
        define ( 'GRAVITY_TOPLEFT',     \Imagick::GRAVITY_NORTHWEST );
        define ( 'GRAVITY_TOPRIGHT',    \Imagick::GRAVITY_NORTHEAST );
        define ( 'GRAVITY_LEFT',        \Imagick::GRAVITY_WEST );
        define ( 'GRAVITY_RIGHT',       \Imagick::GRAVITY_EAST );
        define ( 'GRAVITY_BOTTOMLEFT',  \Imagick::GRAVITY_SOUTHWEST );
        define ( 'GRAVITY_BOTTOMRIGHT', \Imagick::GRAVITY_SOUTHEAST );
        define ( 'GRAVITY_BOTTOM',      \Imagick::GRAVITY_SOUTH );
        define ( 'GRAVITY_CENTER',      \Imagick::GRAVITY_CENTER );
    }
    else
    {
        define ( 'GRAVITY_TOP',         'north' );
        define ( 'GRAVITY_TOPLEFT',     'northwest' );
        define ( 'GRAVITY_TOPRIGHT',    'northeast' );
        define ( 'GRAVITY_LEFT',        'west' );
        define ( 'GRAVITY_RIGHT',       'east' );
        define ( 'GRAVITY_BOTTOMLEFT',  'southwest' );
        define ( 'GRAVITY_BOTTOMRIGHT', 'southeast' );
        define ( 'GRAVITY_BOTTOM',      'south' );
        define ( 'GRAVITY_CENTER',      'center' );
    }

    # </editor-fold>

    # </editor-fold>

    # <editor-fold defaultstate="collapsed" desc="- - - -   I N C L U D E   T H E   C O R E   - - - - - - - - - - - - - - - - - - - - -">

    include UF_BASE_FOLDER . '/Core/Exceptions.php';
    include UF_BASE_FOLDER . '/Core/Interfaces.php';
    include UF_BASE_FOLDER . '/Core/Functions.php';
    include UF_BASE_FOLDER . '/Core/Locale.php';
    include UF_BASE_FOLDER . '/Core/Translator.php';

    # </editor-fold>

    # <editor-fold defaultstate="collapsed" desc="- - - -   S E T   U F   T R A N S L A T I O N   F O L D E R   - - - - - - - - - - - -">

    \UF\Translator::GetInstance()->addTranslationFolder( __DIR__ . '/-translations' );

    # </editor-fold>

}

